essentialsdocsfandomcom-20200214-history
Phone
This page describes the phone application of the Pokégear. The phone allows the player to store the phone numbers of various trainers and other important people, and to call them and receive calls from them at any time. The phone screen The phone screen is displayed by code in the script section PScreen_Phone. The background image for the phone screen is called "phonebg.png" and is located in the folder "Graphics/Pictures". If this image doesn't exist, the background is black. Registering someone Registering someone is the act of adding their phone number to your phone. A new contact will be added to the end of the contact list, which cannot be rearranged. There is no limit on the length of your contact list. Registering a trainer The easiest way to allow a trainer to be registered is to include multiple "Battle" comments in its event - see the page Trainers for more information on trainer event comments. The total number of these comments is the number of times the player can battle them (including the first time), and thus the number of versions of that trainer you should define. In addition, the comment "RegSpeech" is what the trainer will say just before the player registers them (something like "Can we swap phone numbers?"). This is all you need to do - when the game is compiled, the event will be set up appropriately. See the page Rematches for what that event will look like. Registering a special contact To register a non-trainer (e.g. Professor Oak, Mom), you will need to use the following script: pbPhoneRegisterNPC(3,"Professor Oak",27) The first number (3) is a unique identifying number for this contact, which determines which phone call messages are used (see below). Next is the display name of the contact. The second number (27) is the ID number of the map where this NPC is; the map name is shown in the contact list. NPC contacts also need overworld charsets of themselves, to be displayed in the contact list. These charsets are in the folder "Graphics/Characters", and are called "phoneXXX.png", where "XXX" is the identifying number padded to 3 digits. For convenience, the event itself can also use the same charset. The conversations shown when calling these contacts also need to be defined for each contact, as they will all be different. See below for how to define them. Phone calls with trainers These conversations will be the same regardless of whether the player calls the trainer, or the trainer randomly calls the player. These calls can either be idle chatter, or a request for a rematch battle. All phone calls are arrangements of up to three different kinds of dialogue: The possible dialogues for each of the above dialogue types are defined in the PBS file "phone.txt". Each dialogue type has its own section, and each possible dialogue is written on a separate line (see the page Messages for how they can be formatted). Dialogue can reference several things, such as the caller's name and location. To do this, include the following in the dialogue where you want those things to appear: Frequency of calls The time interval between two phone calls is between 20 and 40 minutes, not including time when messages are being displayed or the player is being forced to move via a move route. The caller is chosen at random from the list in the phone (of people who can call the player). You cannot be called by someone if you are on the same map as them. Phone calls with special contacts Each special contact in your phone can be called at any time by choosing them from the phone. They will never call the player, though. The messages shown when calling a special contact are written in a Common Event whose ID number is the special contact's identifying number (3 in the example above). These messages include the "ringing" and "click!" at the beginning/end of the call. As these conversations are defined in a Common Event, it is easy to allow them to be interactive (e.g. to allow Professor Oak to ask whether the player wants him to comment on the Pokédex progress), and allows for them to be rather complex and context-sensitive (e.g. depending on the time of day, or on the player's progress through the game). Technical details The numbers in the phone are stored in the array $PokemonGlobal.phoneNumbers. Each element of this array is an array in itself, listing various values specific to that contact. The length and contents of a contact's array depends on whether the contact is a trainer. For trainer contacts: For non-trainer contacts ("special" contacts): When the player receives a phone call from a trainer, it is from a randomly-chosen trainer out of all the ones that can call the player. Possible callers are those that are on a different map to the one the player is currently on, but are in the same region as the player. The time between successive received phone calls ($PokemonGlobal.phoneTime) is set to a random amount of time between 20 and 40 minutes, and is counted down except when messages are being displayed or the player is being forced to move by a move route. When this time hits 0, a call from a trainer will be generated. Tips * The phone doesn't necessarily need to be a Pokégear app. You can just as easily make a phone item. * Let the player turn their phone on and off, thus allowing or forbidding trainers to call them. ** You could forbid random calls from trainers at certain times, e.g. plot-intensive parts of the game. * Let the player delete contacts from the phone. The majority of the code required to allow this already exists. * You could create a text message system that is also usable by the phone (or the Pokégear). At a very basic level, this would work something like Mail items.